﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 构造方法02
{
    class Teacher
    {
        private string name;
        public string Name
        {
            get{ return name; }
            private set
            {
                if (value != "")
                {
                    name = value;
                }
                else
                {
                    Console.WriteLine("输入的名字不合法");
                }
                
            }
        }

        private bool sex;
        public bool Sex
        {
            get { return sex; }
        }

        private string teachClass;
        public string TeachClass
        {
            get { return teachClass; }
            set { teachClass = value; }
        }

        public Teacher(string name, bool sex, string teachClass)
        {
            this.Name = name;
            this.sex = sex;
            this.teachClass = teachClass;
        }
    }
}
